OPC-UA Embedded Server SDK  2.1.0
Translation and Text Lookup Functions

Functions

const UA_UTF8_string_t * UAServer_Callback_translate (uint16_t locale_index, uint32_t text_handle)
 
const UA_UTF8_string_t * UAServer_Callback_translate_enumstrings (uint16_t locale_index, uint32_t enum_handle, uint16_t enum_index)
 
const UA_UTF8_string_t * UAServer_Callback_translate_internal_text (uint16_t locale_index, uint32_t text_index)
 

Detailed Description

Function Documentation

const UA_UTF8_string_t* UAServer_Callback_translate ( uint16_t  locale_index,
uint32_t  text_handle 
)

Function provided by host to enable library to translate text

The library requires the ability to translate human readable text in order to operate. This ability is provided by this function which must be implemented by the host system. This function is called by the library to get a pointer to the appropriate text for communication to a client using a specified and supported locale. This function is used to lookup translations for nodes created by the host system. A separate callback is used to lookup translations for internal text that the library uses to expose standard OPC-UA nodes in the address space.

Parameters
[in]locale_indexThe index into the previously provided locale table. Ignore if only one locale was provided.
[in]text_handleAn identifier that the host can use to efficiently look up the text string.
Returns
A pointer to the text required to be communicated to the client, or 0 if the text cannot be found. If the library receives a return value of 0 it will retry with a variety of supported locales until it receives a valid result or all locales have been tried.
const UA_UTF8_string_t* UAServer_Callback_translate_enumstrings ( uint16_t  locale_index,
uint32_t  enum_handle,
uint16_t  enum_index 
)

Function provided by host to enable library to translate enumerated text

The library requires the ability to translate human readable text in order to operate. This ability is provided by this function which must be implemented by the host system. This function is called by the library to get a pointer to the appropriate text for communication to a client using a specified and supported locale. This function is used to lookup translations for nodes created by the host system. A separate callback is used to lookup translations for internal text that the library uses to expose standard OPC-UA nodes in the address space.

MultiStateDiscrete Data Access address space nodes contain an enumeration of possible values with a human readable label for each value of the enumeration. When creating the node the host passes in a handle to the enumeration and the number of values. For translation the library calls this function indicating the enumeration handle provided and the index of the required label.

Parameters
[in]locale_indexThe index into the previously provided locale table. Ignore if only one locale was provided.
[in]enum_handleAn identifier that the host can use to efficiently look up the enumeration.
[in]enum_indexAn index into the value of the enumeration indicating the label to be returned.
Returns
A pointer to the text required to be communicated to the client, or 0 if the text cannot be found. If the library receives a return value of 0 it will retry with a variety of supported locales until it receives a valid result or all locales have been tried.
const UA_UTF8_string_t* UAServer_Callback_translate_internal_text ( uint16_t  locale_index,
uint32_t  text_index 
)

Function provided by host to enable library to translate internal text

The library exposes some standard OPC-UA nodes in the server address space. It may be desirable to translate the DisplayNames of these nodes. This API callback is provided to facilitate translation of this text. If you do not wish to provide translation of the internal text, simply return the default English text to the library. If you do wish to provide translated text for the internal text you should implement tables of UTF8 strings for each supported locale. Note: There is no requirement in the OPC-UA standard to provide translations of the internal text even if your server supports multiple locales. In this case nodes you add to the address space will be localized but the standard OPC-UA nodes will not.

Parameters
[in]locale_indexThe index into the previously provided locale table. Ignore if no table was provided.
[in]text_indexAn identifier that the host can use to efficiently look up the text string (a zero based table index).
Returns
A pointer to the text required to be communicated to the client, or 0 if the text cannot be found. If the library receives a return value of 0 it will retry with a variety of supported locales until it receives a valid result or until all locales have been tried.